<?php
/**
 * @author    : liuqiangde<liuqiangde@dalingpao.com>
 * @copyright : 2017-08-22
 * @var $vali Q_Validate
 */
$vali->form->setJsValidate(false);

?>
<div style="text-align:center;padding: 5px;">
    <h2><?=empty($user['id']) ? '新增' : '编辑'?>用户</h2>
</div>
<div style="position:absolute;border-color:#98bf21;width:100%;left:45%" border="1" cellpadding="0" cellspacing="0">

    <form id="user-form" class="add-form" method="post">
        <input type="hidden" value="exec" name="e">
        <?=$vali->form->input('id', [], 'hidden')?>
        <table>
            <tr>
                <td><?=$vali->form->name('name')?></td>
                <td>
                    <?=$vali->form->input('name', ['placeholder' => '请填写姓名'])?>
                    <span><?=$vali->form->error('name')?></span>
                </td>
            </tr>
            <tr>
                <td><?=$vali->form->name('gender')?></td>
                <td>
                    <?=$vali->form->select('gender', ['男', '女'], ['id' => 'gender'])?>
                    <span><?=$vali->form->error('gender')?></span>
                </td>
            </tr>
            <tr>
                <td><?=$vali->form->name('age')?></td>
                <td>
                    <?=$vali->form->input('age')?>
                    <span><?=$vali->form->error('age')?></span>
                </td>
            </tr>
            <tr>
                <td><?=$vali->form->name('nation')?></td>
                <td>
                    <?=$vali->form->input('nation')?>
                    <span><?=$vali->form->error('nation')?></span>
                </td>
            </tr>
            <tr>
                <td><?=$vali->form->name('number')?></td>
                <td>
                    <?=$vali->form->input('number')?>
                    <span><?=$vali->form->error('number')?></span>
                </td>
            </tr>
        </table>
        <div class="" style="position:absolute;left:5%">
            <button class="save" type="submit">
                保存
            </button>
        </div>
    </form>
</div>
<script>
    Q.plugin.validator('#user-form');
</script>